<%@ page language="java" contentType="application/vnd.ms-word; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml"   
         xmlns:o="urn:schemas-microsoft-com:office:office"   
         xmlns:w="urn:schemas-microsoft-com:office:word"   
         xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"   
         xmlns:st1="urn:schemas-microsoft-com:office:smarttags"   
         xmlns="http://www.w3.org/TR/REC-html40">  
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<meta name="ProgId" content="Word.Document">  
<meta name="Generator" content="Microsoft Word 12">  
<meta name="Originator" content="Microsoft Word 12">   
<title>JSP页面导出为Word文档</title>  
</head>
<body>
<%  
    String fileName = "jsp导出word.doc";  
      //对中文文件名编码  
   //fileName = URLEncoder.encode(fileName, "utf-8");  
    byte[] yte = fileName.getBytes("GB2312");  
            String unicoStr = new String(yte, "ISO-8859-1");
   response.setHeader("Content-disposition", "attachment; filename=" + unicoStr);  
%>  
 
。。。页面内容。。。  
</body>  
</html> 